<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>add new singleWord</title>
<link rel="stylesheet" href="../bootstrap/css/bootstrap.css" />

<script type="text/javascript" src="../common/js/jQuery-2.2.0.min.js"></script>
<script type="text/javascript" src="../bootstrap/js/bootstrap.js"></script>
<script
	src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body>
	<div ng-app="mainApp" ng-controller="mainController"
		class="container-fluid">
		<form name="addForm">
			<div class="row">
				<div class="col-sm-6 col-md-6">word:</div>
				<div class="col-sm-6 col-md-6">
					<input type="text" name="name" ng-model="name" />
				</div>
			</div>
			<div class="row">
				<div class="col-sm-6 col-md-6">meaning:</div>
				<div class="col-sm-6 col-md-6">
					<input type="text" name="meaning" ng-model="meaning" />
				</div>
			</div>
			<div class="row">
				<div class="col-sm-12 col-md-12">
					<input type="button" ng-click="add()" value="ADD" />
				</div>
			</div>
		</form>
	</div>
</body>
<script>
	var mainApp = angular.module('mainApp', []);
	mainApp.controller('mainController', function($scope, $http) {
		$scope.add = function() {
			var name = $scope.name;
			var meaning = $scope.meaning;
			$http({
				url : 'add',
				method : 'post',
				params : {
					name : name,
					meaning : meaning
				}
			}).success(function(response) {
				console.log(response);
				window.location.reload();
			});
		};

	});
</script>
</html>